package com.zd.kiychen.controller;

import bo.QueueUseObjet;
import com.alibaba.fastjson.JSON;
import com.zd.kiychen.service.OrderPushService;
import dto.OrderDetailsDTO;
import dto.UserInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vo.ResponseData;

import java.util.List;

/**
 * @program: sporadic
 * @description:
 * @author: LHD   QQ:1727865856
 * @create: 2019-11-23 09:19
 **/
@RestController
public class QueueController {
    @Autowired
    private OrderPushService orderPushService;


    @PostMapping("/addMessage")
    public ResponseData<Boolean> addMessage(@RequestBody QueueUseObjet queueUseObjet) {
        System.out.println(JSON.toJSONString(queueUseObjet));
        boolean result = orderPushService.addQueueMessage(queueUseObjet, queueUseObjet.getUserInfoDTO().getMId());
        return new ResponseData<>(result);
    }

    @GetMapping("/queryQueueOrderInfo")
    public ResponseData<QueueUseObjet> getOrderInfo(Integer mid) {
        return new ResponseData<>(orderPushService.getOrderInfo(mid));
    }
}
